package com.zyf.chapter01.principle.SOLID.DIP.DI;

import com.zyf.chapter01.principle.SOLID.DIP.DI.utils.MessageSender;

/**
 * 非依赖注入实现方式
 * 使用 Notification
 * NotDINotification notDINotification = new NotDINotification();
 * @author yifeng
 */
public class NotDINotification {
    private MessageSender messageSender;

    public NotDINotification() {
        this.messageSender = new MessageSender(); // hardcode
    }

    public void sendMessage(String cellphone, String message) {
        // ... 省略校验逻辑等 ...
        this.messageSender.send(cellphone, message);
    }
}
